home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-06-17 | 1.3 KB | 74 lines | [TEXT/KAHL] |
- //
- // © 1992 Jon Wätte
- // PowerBook screen tester
- //
-
-
- #define FOOLED_YA 1
-
- void
- main ( void )
- {
- GrafPtr p ;
- WindowPtr wp = NULL ;
- Rect r ;
- EventRecord er ;
- RgnHandle rh ;
- #ifdef FOOLED_YA
- int i ;
- long keys [ 4 ] ; // 128 bits
- Boolean flag = 0 ;
- #endif
-
- InitGraf ( & qd . thePort ) ;
- InitFonts ( ) ;
- InitWindows ( ) ;
- TEInit ( ) ;
- InitMenus ( ) ;
- InitDialogs ( NULL ) ;
-
- r = ( * ( GetGrayRgn ( ) ) ) -> rgnBBox ;
- r . top -= GetMBarHeight ( ) ;
- wp = GetNewWindow ( 128 , NULL , NULL ) ;
- SizeWindow ( wp , r . right - r . left , r . bottom - r . top , 0 ) ;
- MoveWindow ( wp , r . left , r . top , 0 ) ;
- SelectWindow ( wp ) ;
- ShowWindow ( wp ) ;
- rh = NewRgn ( ) ;
- GetCWMgrPort ( & p ) ;
- SetPort ( p ) ;
- GetClip ( rh ) ;
- ClipRect ( & r ) ;
- PaintRect ( & r ) ;
- HideCursor ( ) ;
-
- #ifdef FOOLED_YA
-
- GetKeys ( & keys ) ;
- if ( keys [ 1 ] & 0x4 ) { // Option key
-
- PenMode ( patXor ) ;
- qd . randSeed = TickCount ( ) ;
- for ( i = 0 ; i < 5 ; i ++ ) {
-
- MoveTo ( ( Random ( ) & 0x7fff ) % r . right ,
- ( Random ( ) & 0x7fff ) % r . bottom ) ;
- Line ( 0 , 0 ) ;
- }
- }
- #endif
-
- SetClip ( rh ) ;
- SetPort ( wp ) ;
- ValidRect ( & r ) ;
-
- do {
-
- WaitNextEvent ( -1 , & er , 0x7fffffff , NULL ) ;
-
- } while ( er . what != mouseDown && er . what != keyDown ) ;
- ShowCursor ( ) ;
- DrawMenuBar ( ) ;
- }
-
-